#pragma once
#include "PropertiesWnd.h"
#include "MeasureStation.h"
#include "MeasureArc.h"
#include "ROIPane.h"

// CArcWnd

class CArcWnd : public CDockablePane
{
	DECLARE_DYNAMIC(CArcWnd)

public:
	CArcWnd();
	virtual ~CArcWnd();

  void AdjustLayout(void);
  void EnableAll(BOOL bEnable);

public:
  void SetVSDotNetLook(BOOL bSet)
  {
    m_wndPropList.SetVSDotNetLook(bSet);
    m_wndPropList.SetGroupNameFullWidth(bSet);
  }

public:
  void StationSwitch_slot(CMeasureStation* station);
  void ArcAdded_slot(CMeasureArc *a);
  void ArcDeleting_slot(CMeasureArc *a);
  void ArcDeleted_slot(void);
  void ObjAdd_slot(const draw_obj* obj);
  void ObjDelete_slot(const draw_obj* obj);
  void ObjSelect_slot(const draw_obj* obj);
  void TemplateCSChanged_slot(void);

protected:
	DECLARE_MESSAGE_MAP()

protected:
  void InitPropList();
  void SetPropListFont();

protected:
  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  afx_msg void OnSize(UINT nType, int cx, int cy);
  afx_msg void OnExpandAllProperties();
  afx_msg void OnUpdateExpandAllProperties(CCmdUI* pCmdUI);
  afx_msg void OnSortProperties();
  afx_msg void OnUpdateSortProperties(CCmdUI* pCmdUI);
  afx_msg void OnSetFocus(CWnd* pOldWnd);
  afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
  afx_msg LRESULT OnPropertyChanged(WPARAM wParam, LPARAM lParam);
  afx_msg void OnArcSelChange();
  afx_msg void OnUpdateArcComboBox(CCmdUI* pCmdUI);
  afx_msg void OnArcROI();
  afx_msg void OnUpdateArcROI(CCmdUI* pCmdUI);
  afx_msg void OnEditROI();
  afx_msg void OnUpdateEditROI(CCmdUI* pCmdUI);
  afx_msg void OnArcAdd();
  afx_msg void OnUpdateArcAdd(CCmdUI* pCmdUI);
  afx_msg void OnArcDelete();
  afx_msg void OnUpdateArcDelete(CCmdUI* pCmdUI);
  afx_msg void OnArcCopy();
  afx_msg void OnUpdateArcCopy(CCmdUI* pCmdUI);
  afx_msg void OnROICopy();
  afx_msg void OnUpdateROICopy(CCmdUI* pCmdUI);
  afx_msg void OnArcPreview();
  afx_msg void OnUpdateArcPreview(CCmdUI* pCmdUI);
  afx_msg void OnArcSave();
  afx_msg void OnUpdateArcSave(CCmdUI* pCmdUI);
  afx_msg void OnArcFind();
  afx_msg void OnUpdateArcFind(CCmdUI* pCmdUI);

protected:
  CFont m_fntPropList;
  CComboBox m_wndCombo;
  CPropertiesToolBar m_wndToolBar;
  CMFCPropertyGridCtrl m_wndPropList;

public:
  CWnd*     ImageView;

private:
  CMeasureStation* station_;
  CMeasureArc*  arc_;
  boost::signals2::connection obj_delete_signal_connection_;

private:
  CMFCPropertyGridProperty* info_;
  CMFCPropertyGridProperty* name_;

  CMFCPropertyGridProperty* roi_;
  CMFCPropertyGridProperty* roi_x_;
  CMFCPropertyGridProperty* roi_y_;
  CMFCPropertyGridProperty* roi_inner_;
  CMFCPropertyGridProperty* roi_outer_;
  CMFCPropertyGridProperty* roi_start_;
  CMFCPropertyGridProperty* roi_end_;

  CMFCPropertyGridProperty* edge_;
  CMFCPropertyGridProperty* edge_sigma_;
  CMFCPropertyGridProperty* edge_threshold_;
  CMFCPropertyGridProperty* edge_num_boxes_;
  CMFCPropertyGridProperty* edge_box_width_;
  CMFCPropertyGridProperty* edge_transition_;

  CMFCPropertyGridProperty* fitting_;
  CMFCPropertyGridProperty* fitting_clipping_factor_;
  CMFCPropertyGridProperty* fitting_algorithm_;

  CMFCPropertyGridProperty* find_result_;
  CMFCPropertyGridProperty* find_x_;
  CMFCPropertyGridProperty* find_y_;
  CMFCPropertyGridProperty* find_radius_;
};


